﻿namespace Blaze.Framework
{
    using System.Collections.Generic;

    /// <summary>
    /// dictionary with a key of ValueType will box the value to perform comparison / hash code calculation while scanning the hashtable.
    /// here we implement IEqualityComparer and pass it to your dictionary to avoid that GC
    /// </summary>
    public class FloatComparer : IEqualityComparer<float>
    {
        #region IEqualityComparer<float> Members

        bool IEqualityComparer<float>.Equals(float x, float y)
        {
            return x == y;
        }

        int IEqualityComparer<float>.GetHashCode(float obj)
        {
            return obj.GetHashCode();
        }

        #endregion
    }
}